﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<QianBuo.Lottery.Web.Models.Login.FindPwdModel>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>找回密码</title>
    <style type="text/css">.table{ margin:auto;}

.table 
{
  border: solid 1px #e8eef4;
  border-collapse: collapse;
}

.table td 
{
  padding: 5px;   
  border: solid 1px #e8eef4;
}

.table .supersede 
{
  background-color:#F6F6F6
}

.table .th th,.table .th
{
  color:White;
  background:#007F5E url('thems/default/img/r_bg.jpg'); 
  padding:5px;
  height:15px;
}

.table th
{
  color:Black;
  padding: 6px 5px;
  text-align:center;
  background: #E7EBF8; 
  border: solid 1px #DBE0F4;   
}


table td[align=left]
{text-align:left;}
table td[align=right]
{text-align:right;}
table td[align=center]
{text-align:center;}
table th[align=left]
{text-align:left;}
table th[align=right]
{text-align:right;}
table th[align=center]
{text-align:center;}

.field-validation-error{ color:Red;}

    </style>
</head>
<script src="<%=Url.Content("~/Scripts/jquery-1.4.2.js") %>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/jquery.validate.pack.js") %>" type="text/javascript"></script>
<script src="<%=Url.Content("~/Scripts/MicrosoftMvcJQueryValidation.js") %>" type="text/javascript"></script>
<body>
<%Html.EnableClientValidation(); %>
<% Html.BeginForm(); %>
    <div>
        <table class="table" width="600">
            <tr>
                <th colspan='2' align="center">通过邮箱找回登录密码</th>
            </tr>    
            <tr>
                <td align="right">请输入用户名:</td>
                <td align="left"><%=Html.TextBoxFor(p=>p.LoginName) %><%=Html.ValidationMessageFor(p=>p.LoginName) %></td>
            </tr> 
            <tr>
                <td align="right">安全邮箱:</td>
                <td align="left"><%=Html.TextBoxFor(p=>p.Email) %><%=Html.ValidationMessageFor(p=>p.Email) %></td>
            </tr>
            <tr>
                <td colspan='2' align="center"><input id="btnSend" name="btnSend" type="button" value="获取密钥" onclick="btnSend_Click(this)" /></td>
            </tr>
            <tr>
                <td align="right">请输入密钥:</td>
                <td align="left"><%=Html.TextBoxFor(p=>p.InputKey) %><%=Html.ValidationMessageFor(p=>p.InputKey) %></td>
            </tr>
            <tr>
                <td align="right">请输入新密码:</td>
                <td align="left">
                    <input type="password" id="NewPwd" name="NewPwd"/>
                    <%=Html.ValidationMessageFor(p=>p.NewPwd) %>
                    (6-12位任意字符)
                </td>
            </tr>
            <tr>
                <td align="right">请确认新密码:</td>
                <td align="left">
                    <input type="password" id="ConfirmLoginPwd"  name="ConfirmLoginPwd" />
                    <%=Html.ValidationMessageFor(p=>p.ConfirmLoginPwd) %>
                </td>
            </tr>
            <tr>
                <td align="right">请输入验证码:</td>
                <td align="left">
                    <input id="RegestCode" name="RegestCode" />
                    <img src='<%=Url.Content("~/Login/CheckCode/FinPwd") %>' onclick="this.src+='?'" height="25px" alt="点击换一张" />
                    <%=Html.ValidationMessageFor(p=>p.RegestCode) %>
                </td>
            </tr>
            <tr>
                <td colspan='2' align="center"><input id="btnOk" name="btnOk" type="submit" value="确定"/></td>
            </tr>
        </table>
    </div>
    <% Html.EndForm(); %>
    <div style="display:none;"><%= ViewData["msg"]%></div>
</body>
</html>
<script type="text/javascript">

    function getJSON(url, data, callback) {
        $.ajax({
            type: "GET",
            cache: false,
            url: url,
            data: data,
            success: callback,
            dataType: 'json'
        });
    }
    function btnSend_Click(obj) {
        obj.disabled = true;
        var name = document.getElementById("LoginName");
        if (name.value == '') {
            alert('请输入用户名!');
            obj.disabled = false;
            return;
        }
        var email = document.getElementById("Email");
        if (email.value == '') {
            alert('请输入安全邮箱!');
            obj.disabled = false;
            return;
        }
        else {
            getJSON('<%=Url.Action("SendKey","Login") %>', { loginName: name.value,email:email.value }, function (result) {
                if (result.msg.length)
                    alert(result.msg);
                obj.disabled = false;
            });
        }
    }
</script>


